*****************************************************************************************************************************************************
* PROJECT: 		Exposure to the COVID-19 Stock Market Crash and its Effect on Household Expectations
* DATE: 		Nov 2020
* CONTENT: 		FIGURES
* AUTHORS: 		Tobin Hanspal, Johannes Wohlfart, Anni Weber
*****************************************************************************************************************************************************

		clear all
		set scheme lean2
		global pm = char(177)
		set more off
		gl date = c(current_date)
		graph set window fontface "cmr10"
		
		
* set cd as /Replication_files_HanspalWeberWohlfart2020/


*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~						
** FIGURE A3
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~	
	
use data/processed/data_1, clear 
keep if control_pure ==1
keep if stockinvestor==1

	foreach x in realized planned {
		gen increase_`x' = (stocktrades_`x'3==1)*100
		gen nochange_`x' = (stocktrades_`x'3==2)*100
		gen decrease_`x' = (stocktrades_`x'3==3)*100
	}
	
* REALIZED	
	* stock change by netwealth
	graph bar (mean)  nochange_realized increase_realized  decrease_realized  , ///
			over(netwealth_Jan20_grp, relabel(1 1 2 2 3 3 4 4 5 5)) b1title() ///
			bargap(0) stack  /// 
			ytitle("Realized change in risky share" "% of respondants", size(medsmall)) ///
			 graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "No change") label(2 "Increase") ///
			label(3 "Decrease")) saving(Figures/temp1.gph, replace)		
						
	* stock change by age
	graph bar (mean)   nochange_realized increase_realized  decrease_realized   , ///
			over(agecat, relabel(1 "18-24" 2 "25-34" 3 "35-44" 4 "45-54" 5 "55-64" 6 "65+") label(labsize(small))) b1title() ///
			bargap(0) stack /// 
			ytitle("", size(medsmall)) ///
			 graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "No change") label(2 "Increase") ///
			label(3 "Decrease"))  saving(Figures/temp2.gph, replace)		
		
	* stock change by netincome
	graph bar (mean)   nochange_realized increase_realized  decrease_realized , ///
			over(hhnetinc_2019_grp) b1title() ///
			bargap(0) stack /// 
			ytitle("", size(medsmall)) ///
			 graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "No change") label(2 "Increase") ///
			label(3 "Decrease")) saving(Figures/temp3.gph, replace)		
	

* PLANNED	
	* stock change by netwealth
	graph bar (mean)  nochange_planned increase_planned decrease_planned  , ///
			over(netwealth_Jan20_grp, relabel(1 1 2 2 3 3 4 4 5 5))  b1title(Net wealth quintile, size(medsmall)) ///
			bargap(0) stack  /// 
			ytitle("Planned change in risky share" "% of respondants", size(medsmall)) ///
			 graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "No change") label(2 "Increase") ///
			label(3 "Decrease")) saving(Figures/tempa1.gph, replace)		
					
		
	* stock change by age
	graph bar (mean)   nochange_planned increase_planned decrease_planned  , ///
			over(agecat, relabel(1 "18-24" 2 "25-34" 3 "35-44" 4 "45-54" 5 "55-64" 6 "65+") label(labsize(small))) b1title(Age group, size(medsmall)) ///
			bargap(0) stack /// 
			ytitle("", size(medsmall)) ///
			 graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "No change") label(2 "Increase") ///
			label(3 "Decrease"))  saving(Figures/tempa2.gph, replace)		
		
	* stock change by netincome
	graph bar (mean)  nochange_planned increase_planned decrease_planned , ///
			over(hhnetinc_2019_grp) b1title(Net income quintile, size(medsmall)) ///
			bargap(0) stack /// 
			ytitle("", size(medsmall)) ///
			 graphregion(color(white)) bgcolor(white) ///
			ylabel(, nogrid)  legend(size(small) pos(6) ring(1) cols(6) ///
			label(1 "No change") label(2 "Increase") ///
			label(3 "Decrease")) saving(Figures/tempa3.gph, replace)		
		
	grc1leg2 		Figures\temp1.gph ///
					Figures\temp3.gph  ///
					Figures\temp2.gph  ///
					Figures\tempa1.gph  ///
					Figures\tempa3.gph  ///
					Figures\tempa2.gph , cols(3) rows(2) ysize(3) xsize(5)  lsize(vsmall)
			
	graph export Figures/FigureA3.pdf, as(pdf) fontface("cmr10") replace			
	graph export Figures/FigureA3.png, width(1600) replace	
	
	
forvalues x = 1/3 {
		capture erase Figures/temp`x'.gph
		capture erase Figures/tempa`x'.gph
}
